class CreateNodeConfs < ActiveRecord::Migration
  def self.up
    create_table :node_confs do |t|
      # The Foreign Key
      t.integer   access_node_id
      
      # ACL
      t.integer   acl_mac_mode_ap1  :default => 0
      t.integer   acl_mac_mode_ap2  :default => 0
      
      # BATMAN
      t.string    batman_package_version
      t.string    batman_package_revision
      t.string    batman_package_bmx  :defalt => 0
      t.boolean   batman_node_change_type :default => 0
      t.string    batman_node_type  :default => "client"
      t.boolean   batman_node_announce  :default => 1
      t.string    batman_node_tunnel_iface  :default => "gate0"
      t.integer   batman_node_originator_interval :default => 1500
      t.integer   batman_node_gateway_class :default => 5000
      t.string    batman_node_preferred_gateway 
      t.integer   batman_node_routing_class :default => 1
      t.integer   batman_node_hop_penalty :default => 30
      t.boolean   batman_node_enable_vis  :default => false
      t.boolean   batman_gateway_forced :default => false
      t.string    batman_gateway_address :default => "192.168.1.10/24"
      t.string    batman_gateway_default  :default => "192.168.1.1"
      t.string    batman_gateway_dns  :default => "151.99.125.2"
      
      # General
      t.string    general_services_name_svr :default => "18.26.4.9"
      t.string    general_services_updt_svr :default => "auth.freethenet.ca"
      t.string    general_services_upgd_svr :default => "auth.freethenet.ca/firmware/mr3201a"
      t.string    general_services_beat_svr :default => "auth.freethenet.ca"
      
      # IP Rules
      t.boolean    SMTP_rdir :default => false
      t.string     SMTP_dest  :default => "0.0.0.0"
      t.boolean    LAN_block  :default => false
      
      # MadWifi
      t.boolean   madwifi_priv_option_skip  :default => false
      t.string    madwifi_priv_mode :default => "ahdemo"
      t.integer   madwifi_priv_frag :default => 2346
      t.integer   madwifi_priv_rts  :default => 256
      t.string    madwifi_priv_rate :default => "auto"
      t.integer   madwifi_priv_distance :default => 2000
      t.integer   madwifi_priv_mcast_rate :default => 5500
      t.boolean   madwifi_priv_option_wmm :default => false
      t.boolean   madwifi_priv_option_doth  :default => false
      t.boolean   madwifi_priv_option_ablot :default => false
      
      # Management
      t.boolean management_enable_heartbeat :default => true
      t.boolean management_enable_https :default => true
      t.boolean management_enable_update :default => false
      t.boolean management_enable_batch_update :default => false
      t.boolean management_enable_upgrade :default => true
      t.boolean management_enable_gw_repository :default => false
      t.boolean management_enable_force_reboot :default => false
      t.string management_enable_rootpwd :default => "0p3nm35h"
      t.boolean management_enable_defessid :default => 0
      t.boolean management_enable_bridge :default => 1
      t.string management_enable_captive_portal :default => "wifidog"
      t.string management_enable_base  :default => "beta"
      
      # Mesh
      t.string mesh_iface_device  :default => "ath0"
      t.string mesh_iface_essid   :default => "open-mesh""
      t.string mesh_iface_bssid   :default => "02:ca:ff:ee:ba:be"
      t.integer mesh_iface_chan    :default => 5
      t.integer mesh_iface_net     :default => 5
      t.integer mesh_iface_prefix  :default => 8

      
      t.boolean mesh_ap_up      :default => true
      t.string mesh_ap_device   :default => "ath1"
      t.integer mesh_ap_net     :default => 10
      t.integer mesh_ap_prefix  :default => 25

      t.boolean mesh_Myap_up     :default => true
      t.string mesh_Myap_device   :default => "ath2"
      t.integer mesh_Myap_net      :default => 10
      t.integer mesh_Myap_prefix   :default => 25

      # Wireless
      
      t.string mesh_wan_device   :defalt => "eth0"
      t.string mesh_lan_device   :defalt => "eth0"
      
      t.string  wifi_device_wifi0_type       :default => "atheros"
      t.integer wifi_device_wifi0_channel    :default => 5 
      t.string  wifi_device_wifi0_agmode     :default => "11g"
     
      t.string  wifi_iface_mesh_device       :default => "wifi0"
      t.string  wifi_iface_mesh_network     :default => "mesh"
      t.string  wifi_iface_mesh_mode       :default => "ap"
      t.string  wifi_iface_mesh_ssid       :default => "robin"
      t.string  wifi_iface_mesh_hidden     :default => '0'
      t.string  wifi_iface_mesh_encryption :default => 'none'
      
      t.string  wifi_iface_public_device     :default => "wifi0"
      t.string  wifi_iface_public_network    :default => "ap1"
      t.string  wifi_iface_public_mode       :default => "ap"
      t.string  wifi_iface_public_ssid       :default => "FreeTheNet.ca"
      t.string  wifi_iface_public_hidden     :default => '0'
      t.string  wifi_iface_public_encryption :default => 'none'
      
      t.string  wifi_iface_private_device     :default => "wifi0"
      t.string  wifi_iface_private_network    :default => "ap1"
      t.string  wifi_iface_private_mode       :default => "ap"
      t.string  wifi_iface_private_ssid       :default => "FreeTheNet.ca_Secure"
      t.string  wifi_iface_private_hidden     :default => '0'
      t.string  wifi_iface_private_encryption :default => 'psk'
      t.string  wifi_iface_private_key        :default => '0p3nm35h'
      
      t.timestamps
    end
  end

  def self.down
    drop_table :node_confs
  end
end
